import 'package:flutter/material.dart';
import 'package:flutter_eve_plugin/components/ye_xiu/checkpoint/checkpoint_pass_list.dart';
import 'package:flutter_eve_plugin/components/ye_xiu/checkpoint/checkpoint_pass_rank_top.dart';
import 'package:flutter_eve_plugin/pages/ye_xiu/checkpoint/actions.dart';
import 'package:flutter_eve_plugin/store/main.dart';
import 'package:flutter_eve_plugin/store_vm/app_vm.dart';
import 'package:flutter_eve_plugin/utils/image_util.dart';
import 'package:flutter_redux/flutter_redux.dart';

class CheckpointPassRankPage extends StatefulWidget {
  final String title;
  CheckpointPassRankPage({Key key, this.title}) : super(key: key);

  _CheckpointPassRankPageState createState() => _CheckpointPassRankPageState();
}

class _CheckpointPassRankPageState extends State<CheckpointPassRankPage> {
  @override
  Widget build(BuildContext context) {
    return StoreConnector<AppState, AppStateViewModel>(onInit: (store) {
      store.dispatch(
          rank(store.state.yeXiuState.checkpointState.dungeonid, context));
    }, converter: (store) {
      return AppStateViewModel(state: store.state);
    }, builder: (context, vm) {
      return Container(
        decoration: BoxDecoration(
            image: DecorationImage(
                fit: BoxFit.fill,
                image: AssetImage(
                    imageUtilYeXiu('checkpoint/icon_pass_rank_bg@3x')))),
        child: Stack(
          children: <Widget>[
            CheckpointPassRankListWidget(),
            CheckpointPassRankTopWidget(),
          ],
        ),
      );
    });
  }
}
